package com.dgut.crm.user;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

import com.dgut.crm.demo.entity.User;
import com.dgut.crm.demo.service.IUserService;


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={
		"classpath:applicationContext-core.xml"
		,"classpath:applicationContext-jpa.xml"
})
@Transactional
public class UserServiceTestJPA
{
	@Autowired
	private IUserService userService;
	
	@Test
	@Rollback(value=false)
	public void save() {
		for (int i = 1; i <=100; i++) {
			User user = new User();
			user.setUserName("Guest"+i);
			user.setPassword("123");
			
			userService.saveOrUpdate(user);
		}
	}
}
